package com.order.frontend.order.controller;

import com.order.frontend.order.Entity.Message.Messages;
import com.order.frontend.order.Entity.cs.csThread;
import com.order.frontend.order.service.MessageService;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;

@RestController
@RequestMapping("/v1")
public class testController {
    @Resource
    private MessageService  messageService;
    @Resource
    RedisTemplate redisTemplate;
    @Resource
    RedissonClient redissonClient;
    @Resource
    ThreadPoolExecutor ThreadPoolExecutor;
    @RequestMapping("/get")
    public String cs(){

        for (int i = 0; i < 2; i++) {
            ThreadPoolExecutor.execute(new csThread("测试信息"+i,redissonClient));
        }


        return "测试信息1";
    }
    @RequestMapping("/get2")
    public List<Messages>  cs2(){
        List<Messages> list = messageService.list();
        return list;
    }
}
